package com.zhaopin.theswordreferstooffer;

import java.util.Arrays;

/**
 * @author yin.peide
 * @date 2021-06-08 17:11
 * 面试题12： 打印1到最大的n位数
 */
public class Offer12 {
    public static void main(String[] args) {

        int[] ints = printNumbers(2);
        Arrays.stream(ints).forEach(t -> {
            System.out.println(t);
        });
    }

    public static int[] printNumbers(int n) {
        //统计总共需要打印多少个数字
        int size = (int) Math.pow(10, n) - 1;
        int[] res = new int[size];
        for (int i = 0; i < size; i++) {
            res[i] = i + 1;
        }
        return res;
    }

}
